<?php
/**
 * @Author: Ron Chen
 * @Date:   2017-09-09 19:36:51
 * @Last Modified by:   Ron Chen
 * @Last Modified time: 2017-10-07 23:13:49
 */
namespace api\controllers;

use yii\filters\AccessControl;
use yii\web\Request;
use Yii;
use common\services\MenuUserService;

class MenuController extends BaseController
{
    
    /**
     *@name 小程序菜单首页操作
     *@param 
     	-p_id 获取菜单的类型 0:默认是获取顶级菜单,1:获取二级菜单列表
     */
    public function actionIndex()
    {
    	$pid = trim($this->request->post('p_id'));
    	$menuService = new MenuUserService();
    	
    	$data = $pid ? $menuService->getSubMenuList($pid) : $menuService->getMenuList();
    	
        return $this->returnResponse($data);
    }

    
    /**
     * @name 小程序菜单首页操作
     */
    public function actionSaveInfo()
    {
    	$data = $this->request->post();
    	
        return $this->returnResponse($data);
    }
}